<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
	<Script file="FloLib_localization.lua"/>
	<Script file="FloLib.lua"/>
	<CheckButton name="FloButtonTemplate" inherits="ActionButtonTemplate, SecureActionButtonTemplate" virtual="true">
		<Size>
			<AbsDimension x="30" y="30"/>
		</Size>
		<Scripts>
			<OnLoad>
				local cooldown = _G[self:GetName().."Cooldown"];
				cooldown:SetFrameLevel(cooldown:GetFrameLevel() + 2);
				cooldown:SetScale(.83);	
				self:RegisterForDrag("LeftButton", "RightButton");
				local normalTexture = _G[self:GetName().."NormalTexture"];
				normalTexture:SetWidth(54);	
				normalTexture:SetHeight(54);	
			</OnLoad>
			<OnDragStart>
				if not InCombatLockdown() and (LOCK_ACTIONBAR ~= "1" or IsShiftKeyDown()) then
					local spell = self:GetParent().spells[self:GetID()];
					if spell then
						PickupSpell(spell.name);
					end
				end
			</OnDragStart>
			<PreClick>
				self:SetChecked(not self:GetChecked());
			</PreClick>
			<OnMouseUp>
				FloLib_BarDropDown_Show(self:GetParent(), button);
				FloLib_ReceiveDrag(self);
			</OnMouseUp>
			<OnReceiveDrag>
				FloLib_ReceiveDrag(self, true);
			</OnReceiveDrag>
			<OnEnter>
				FloLib_Button_SetTooltip(self);
			</OnEnter>
			<OnUpdate>
				if GameTooltip:GetOwner() == self then
					FloLib_Button_SetTooltip(self);
				end
			</OnUpdate>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
		</Scripts>
	</CheckButton>
	<Frame name="FloBarTemplate" parent="UIParent" enableMouse="true" movable="true" hidden="true" virtual="true">
		<Size>
			<AbsDimension x="44" y="44"/>
		</Size>
		<Frames>
			<CheckButton name="$parentButton1" inherits="FloButtonTemplate" id="1">
				<Anchors>
					<Anchor point="LEFT">
						<Offset>
							<AbsDimension x="8" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton2" inherits="FloButtonTemplate" id="2">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton1" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton3" inherits="FloButtonTemplate" id="3">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton2" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton4" inherits="FloButtonTemplate" id="4">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton3" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton5" inherits="FloButtonTemplate" id="5">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton4" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton6" inherits="FloButtonTemplate" id="6">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton5" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton7" inherits="FloButtonTemplate" id="7">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton6" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton8" inherits="FloButtonTemplate" id="8">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton7" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton9" inherits="FloButtonTemplate" id="9">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton8" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<CheckButton name="$parentButton10" inherits="FloButtonTemplate" id="10">
				<Anchors>
					<Anchor point="LEFT" relativeTo="$parentButton9" relativePoint="RIGHT">
						<Offset>
							<AbsDimension x="5" y="0"/>
						</Offset>
					</Anchor>
				</Anchors>
			</CheckButton>
			<Frame name="$parentDropDown" inherits="UIDropDownMenuTemplate" id="1" hidden="true">
				<Anchors>
					<Anchor point="TOP">
						<Offset>
							<AbsDimension x="-80" y="-35"/>
						</Offset>
					</Anchor>
				</Anchors>
				<Scripts>
					<OnLoad>
						FloLib_BarDropDown_OnLoad(self);
					</OnLoad>
					<OnShow>
						FloLib_BarDropDown_OnLoad(self);
					</OnShow>
				</Scripts>
			</Frame>
		</Frames>
		<Scripts>
			<OnMouseUp>
				FloLib_BarDropDown_Show(self, button);
			</OnMouseUp>
			<OnDragStart>
				if self.settings.position == "unlock" then
					self:StartMoving();
				end
			</OnDragStart>
			<OnDragStop>
				if self.settings.position == "unlock" then
					self:StopMovingOrSizing();
					--ValidateFramePosition(self);
				end
			</OnDragStop>
		</Scripts>
	</Frame>
	<StatusBar name="FloCountdown" drawLayer="BORDER" orientation="VERTICAL" enableMouse="true" virtual="true">
		<Size>
			<AbsDimension x="10" y="30"/>
		</Size>
		<Anchors>
			<Anchor point="LEFT">
				<Offset>
					<AbsDimension x="8" y="0"/>
				</Offset>
			</Anchor>
		</Anchors>
		<Layers>
			<Layer level="BACKGROUND">
				<Texture setAllPoints="true">
					<Color r="0" g="0" b="0" a="0.7"/>
				</Texture>
			</Layer>
		</Layers>
		<BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
		<BarColor r="1.0" g="0.7" b="0.0"/>
		<Scripts>
			<OnLoad>
				self:SetMinMaxValues(0,1);
				self:SetValue(0);
			</OnLoad>
			<OnMouseUp>
				if self:GetParent().slot and IsAltKeyDown() then
					DestroyTotem(self:GetParent().slot);
				else
					FloLib_BarDropDown_Show(self:GetParent(), button);
				end
			</OnMouseUp>
			<OnEnter>
				if self:GetValue() ~= 0 then
					GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
					GameTooltip:SetText(string.format(SecondsToTimeAbbrev(self:GetValue())), HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
					GameTooltip:AddLine();
				end
			</OnEnter>
			<OnLeave>
				GameTooltip:Hide();
			</OnLeave>
			<OnUpdate>
				if GameTooltip:GetOwner() == self and self:GetValue() ~= 0 then
					GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
					GameTooltip:SetText(string.format(SecondsToTimeAbbrev(self:GetValue())), HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b);
					GameTooltip:AddLine();
				end
			</OnUpdate>
			<OnDragStart>
				if self:GetParent().settings.position == "unlock" then
					self:GetParent():StartMoving();
				end
			</OnDragStart>
			<OnDragStop>
				if self:GetParent().settings.position == "unlock" then
					self:GetParent():StopMovingOrSizing();
					--ValidateFramePosition(self:GetParent());
				end
			</OnDragStop>
		</Scripts>

	</StatusBar>
</Ui>
